import { commonAjax } from 'Ajax'

import Vue from 'vue'
import VueCacheData from 'vue-cache-data'
Vue.use(VueCacheData)
const commonDatas = new VueCacheData()
commonDatas.add('memberList', {}, function(onSucc, onFail) {
  commonAjax.getSelectList().then(data => {
    return onSucc(data)
  })
})
commonDatas.add('addressTreeList', [], function(onSucc, onFail) {
  commonAjax.getAddressTree().then(data => {
    return onSucc(data)
  })
})
commonDatas.add('getRootGroup', [], function(onSucc, onFail) {
  commonAjax.getRootGroupList().then(data => {
    return onSucc(data)
  })
})
commonDatas.init()
export const commonData = commonDatas.vm
